package com.woniuxy.house.mapper;

import com.woniuxy.house.entity.HouseDetail;
import com.woniuxy.house.entity.HousePictures;
import com.woniuxy.house.provider.HouseDetailSqlProvider;
import com.woniuxy.house.provider.HousePicturesSqlProvider;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 *房屋内照片的mapper
 */
public interface HousePicturesMapper {
    /**
     * 增加房屋房间照片
     * @魏锦鹏
     */
    @Insert("insert into house_pictures (name,picture,source_id) values (#{name},#{picture},#{source.id})")
    void add(HousePictures housePictures);
    /**
     * 修改房屋房间照片
     * @魏锦鹏
     */
    @UpdateProvider(type = HousePicturesSqlProvider.class, method = "update")
    void updateByCondition(HousePictures housePictures);
    /**
     * 根据房源id查询房屋房间照片
     * @魏锦鹏
     */
    @Select("select*from house_pictures hp,house_source hs where hp.source_id=hs.id and hs.id=#{id}")
//查出对应房源id的房间图片
    List<HousePictures> selectBySourceId(Integer sourceId);
	@Delete("delete from house_pictures where id=#{id}")
	void deletePictureById(Integer id);
}
